import cv2
import numpy as np

# 假设points是一个包含四个点的数组，例如: np.array([[x1, y1], [x2, y2], [x3, y3], [x4, y4]])
points = np.array([[100, 100], [200, 100], [200, 200], [100, 200]])

# 必须是一个2D点集
points = points.reshape((-1, 1, 2))

# epsilon是近似精度参数，值越大，近似越精确
epsilon = 5.0

# 使用cv2.approxPolyDP近似轮廓
approxCurve = cv2.approxPolyDP(points, epsilon, True)

# 输出近似后的轮廓点
print(approxCurve)